local hx__wushiwudong = fk.CreateSkill {
  name = "hx__wushiwudong",
}


local spec = {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    local cards = player:getCardIds{Player.Hand, Player.Equip, Player.Judge}
    local max = table.filter(cards, function(id)
      local card = Fk:getCardById(id)
      return not card.is_damage_card
    end)
    return target == player and player:hasSkill(hx__wushiwudong.name) and
    string.find(Fk:translate(":" .. data.card.name, "zh_CN"), "伤害") ~= nil and #max > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cards = player:getCardIds{Player.Hand, Player.Equip, Player.Judge}
    local max = table.filter(cards, function(id)
      local card = Fk:getCardById(id)
      return not card.is_damage_card
    end)
    local others = room:getOtherPlayers(player)
    local num = math.random(0, #others)
    if num > 0 then
      for _, p in ipairs(table.random(others,num)) do
        local x = math.random(0, #max)
        room:sendLog{
          type = "#hx__wushiwudong",
          from = player.id,
          to = {p.id},
          arg = x,
        }
        if x > 0 then
          room:damage{
            from = player,
            to = p,
            damage = x,
            skillName = hx__wushiwudong.name,
          }
        end
      end
    end
  end,
}

hx__wushiwudong:addEffect(fk.CardUsing, spec )
hx__wushiwudong:addEffect(fk.CardResponding, spec)


return hx__wushiwudong
